﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using SharpMap.Tools;
using SharpMap.Rendering.Rendering2D;
using SharpMap.Presentation.Views;
namespace SharpMap.Wpf
{
    public class WpfMapTool : IMapTool<IMapView2D, Point2D>
    {
        public CommandBinding QueryToolCommandBinding
        {
            get { return _queryToolCommandBinding; }
            set { _queryToolCommandBinding = value; }
        }

        public CommandBinding BeginToolCommandBinding
        {
            get { return _beginToolCommandBinding; }
            set { _beginToolCommandBinding = value; }
        }

        public CommandBinding ExtendToolCommandBinding
        {
            get { return _extendToolCommandBinding; }
            set { _extendToolCommandBinding = value; }
        }

        public CommandBinding EndToolCommandBinding
        {
            get { return _endToolCommandBinding; }
            set { _endToolCommandBinding = value; }
        }

        public InputBinding QueryInputBinding
        {
            get { return _queryInputBinding; }
            set { _queryInputBinding = value; }
        }

        public InputBinding BeginInputBinding
        {
            get { return _beginInputBinding; }
            set { _beginInputBinding = value; }
        }

        public InputBinding ExtendInputBinding
        {
            get { return _extendInputBinding; }
            set { _extendInputBinding = value; }
        }

        public InputBinding EndInputBinding
        {
            get { return _endInputBinding; }
            set { _endInputBinding = value; }
        }
  
        public Cursor Cursor { get; set; }

    

        #region IMapTool<IMapView2D,Point2D> Members

        public string Name
        {
            get { return _name; }
        }

        Action<ActionContext<IMapView2D, Point2D>> IMapTool<IMapView2D, Point2D>.QueryAction
        {
            get 
            {
                return (ActionContext<IMapView2D, Point2D> param) => _queryToolCommandBinding.Command.Execute(param);
            }
        }

        Action<ActionContext<IMapView2D, Point2D>> IMapTool<IMapView2D, Point2D>.BeginAction
        {
            get 
            {
                return (ActionContext<IMapView2D, Point2D> param) => _beginToolCommandBinding.Command.Execute(param);
            }
        }

        Action<ActionContext<IMapView2D, Point2D>> IMapTool<IMapView2D, Point2D>.ExtendAction
        {
            get
            {
                return (ActionContext<IMapView2D, Point2D> param) => _extendToolCommandBinding.Command.Execute(param);
            }
        }

        Action<ActionContext<IMapView2D, Point2D>> IMapTool<IMapView2D, Point2D>.EndAction
        {
            get 
            {
                return (ActionContext<IMapView2D, Point2D> param) => _endToolCommandBinding.Command.Execute(param);
            }
        }

        #endregion


        string _name;
        CommandBinding _queryToolCommandBinding = new CommandBinding();
        CommandBinding _beginToolCommandBinding = new CommandBinding();
        CommandBinding _extendToolCommandBinding = new CommandBinding();
        CommandBinding _endToolCommandBinding = new CommandBinding();

        InputBinding _queryInputBinding;
        InputBinding _beginInputBinding;
        InputBinding _extendInputBinding;
        InputBinding _endInputBinding;

    }
}
